﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;
using BIS.Portal.Modules.CMS.BO;
using BIS.Portal.Modules.CMS.Entity;

namespace BIS.Portal.Modules.CMS
{
    public partial class CmsFreeMediaControl_Settings : ControlSettingBase
    {
        #region Load Data Settings

        public string ArticleFreeText
        {
            get
            {
                return GetControlSetting<string>(ModuleSettingNames.CmsFreeMedia.ddlArticleFreeText,PortalContext.LanguageAlias);
            }
        }
        public string SLAnhHienThi
        {
            get
            {
                return GetControlSetting<string>(ModuleSettingNames.CmsFreeMedia.txtSLAnh,PortalContext.LanguageAlias);
            }
        }
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            loaddata();
        }
        private void loaddata()
        {
            IList<ClientCmsArticleFreeTextEntity> objFT =
                ClientCmsArticleBO.GetArticleFreeText(PortalContext.LanguageInUseId);
            ddlArticleFreeText.DataSource = objFT;
            ddlArticleFreeText.DataTextField = "ArticleTitle";
            ddlArticleFreeText.DataValueField = "ArticleId";
            ddlArticleFreeText.DataBind();
            ddlArticleFreeText.SelectedValue = ArticleFreeText;
            txtSLAnh.Text = SLAnhHienThi;
        }
        public override void SaveSettings(Dictionary<string, string> settings)
        {
            SetControlSettingForAllLanguages(ddlArticleFreeText.ID, ModuleSettingNames.CmsFreeMedia.ddlArticleFreeText, settings);
            SetControlSettingForAllLanguages(txtSLAnh.ID, ModuleSettingNames.CmsFreeMedia.txtSLAnh, settings);
        }
    }
}